package com.server.db.bean;

import com.sandking.tools.SK_Map;
import java.util.ArrayList;
import com.server.db.imp.YhzaImp;
import com.server.db.imp.YhysImp;
import com.alibaba.fastjson.JSON;
import java.util.Map;
import com.server.db.imp.YhImp;
import com.sandking.tools.SK_Plus;
import java.util.List;
import com.server.db.imp.LmImp;
import com.server.db.imp.YhbbImp;
import java.util.HashMap;
import com.server.db.imp.YhyxImp;
import com.server.db.imp.YhzsImp;
import com.server.db.imp.YhyjImp;
import com.server.db.imp.FwqImp;
import com.sandking.io.SK_ByteBuff;
import com.server.db.imp.YhjzImp;
import com.server.db.imp.LtImp;
import com.server.db.imp.YhlxImp;
import com.server.db.imp.YhxjImp;

/**
 * 用户
 */
public class Yh {

	public static final String TABLE_NAME = "用户";
	public static final String CLASS_NAME = "Yh"; 
	static final int MAX_GET = Short.MAX_VALUE;
	
	//索引名称
	public static final String  Id_IndexName = "id";
	public static final String  Nc_IndexName = "nc";
	public static final String  Zh_IndexName = "zh";
	public static final String  ZhMm_IndexName = "zhmm";
	public static final String  Yhlx_id_IndexName = "yhlx_id";
	public static final String  Fwq_id_IndexName = "fwq_id";
	public static final String  Qd_IndexName = "qd";
	public static final String  Lm_id_IndexName = "lm_id";
	public static final String  QdYhlx_id_IndexName = "qdyhlx_id";
	
	//对象版本号	
	private int _v = 0;
	public int _nextVer(){
		if(_v > MAX_GET) _v = 0;
		return ++_v;
	}
	
	public int _getVer(){
		return _v;
	}
	
	//是否是源对象
	private boolean _source = false;
	
	public boolean is_source() {
		return _source;
	}

	public void set_source(boolean _source) {
		this._source = _source;
	}
	
	//Cache 中的索引
	private String  id_Unique = null;
	private String  nc_Unique = null;
	private String  zh_Unique = null;
	private String  zhmm_Unique = null;
	private String  yhlx_id_Index = null;
	private String  fwq_id_Index = null;
	private String  qd_Index = null;
	private String  lm_id_Index = null;
	private String  qdyhlx_id_Index = null;
	public Yh updatePrimaryIndex(){
		return updatePrimaryIndex(this);
	}
	
	public static List<Yh> updatePrimaryIndex(List<Yh> yhs){
		for(Yh yh : yhs){
			updatePrimaryIndex(yh);	
		}
		return yhs;
	}
	
	public static Yh updatePrimaryIndex(Yh yh){
		String field = SK_Plus.b(yh.getId()).e();
		yh.setId_Unique(field);
		
		field = SK_Plus.b(yh.getNc()).e();
		yh.setNc_Unique(field);
		
		field = SK_Plus.b(yh.getZh()).e();
		yh.setZh_Unique(field);
		
		field = SK_Plus.b(yh.getZh(),"_",yh.getMm()).e();
		yh.setZhMm_Unique(field);
		
		field = SK_Plus.b(yh.getYhlx_id()).e();
		yh.setYhlx_id_Index(field);
		
		field = SK_Plus.b(yh.getFwq_id()).e();
		yh.setFwq_id_Index(field);
		
		field = SK_Plus.b(yh.getQd()).e();
		yh.setQd_Index(field);
		
		field = SK_Plus.b(yh.getLm_id()).e();
		yh.setLm_id_Index(field);
		
		field = SK_Plus.b(yh.getQd(),"_",yh.getYhlx_id()).e();
		yh.setQdYhlx_id_Index(field);
		
		return yh;
	}
	
	
	/**
	 * 需要更新字段集
	 */
	private Map<String, Object> updateColumns;

	/* 可能需要补救的字段 */
	private SK_ByteBuff byteBuff = SK_ByteBuff.allocate();
	
	public SK_ByteBuff getSK_ByteBuff(){
		return this.byteBuff;
	}
	
	/** id */
	private int id;
	
	/** 昵称 */
	private String nc;
	
	/** 创建时间 */
	private java.util.Date cjsj;
	
	/** 最后登录时间 */
	private java.util.Date zhdlsj;
	
	/** 语言 */
	private String yy;
	
	/** 账号 */
	private String zh;
	
	/** 密码 */
	private String mm;
	
	/** 宝石 */
	private int bs;
	
	/** 假宝石 */
	private int jbs;
	
	/** 金币 */
	private int jb;
	
	/** 水 */
	private int s;
	
	/** 修炼点 */
	private int xld;
	
	/** 设备 */
	private String sb;
	
	/** 设备系统 */
	private String sbxt;
	
	/** 分辨率 */
	private String fbl;
	
	/** 渠道 */
	private String qd;
	
	/** 用户类型_id */
	private int yhlx_id;
	
	/** 用户lvl */
	private int yhlvl;
	
	/** 用户lvl_exp */
	private int yhlvl_exp;
	
	/** VIP */
	private int vIP;
	
	/** VIP_exp */
	private int vIP_exp;
	
	/** 充值金额 */
	private int czje;
	
	/** 幸运 */
	private int xy;
	
	/** 客户端版本 */
	private String khdbb;
	
	/** 服务器_id */
	private int fwq_id;
	
	/** 主城lvl */
	private int zclvl;
	
	/** 锁定 */
	private boolean sd;
	
	/** 联盟_id */
	private int lm_id;
	
	
	public Yh() {
		super();
		this._source = true;
	}
	
	public Yh(int id, String nc, java.util.Date cjsj, java.util.Date zhdlsj, String yy, String zh, String mm, int bs, int jbs, int jb, int s, int xld, String sb, String sbxt, String fbl, String qd, int yhlx_id, int yhlvl, int yhlvl_exp, int vIP, int vIP_exp, int czje, int xy, String khdbb, int fwq_id, int zclvl, boolean sd, int lm_id) {
		super();
		this.id = id;
		this.nc = nc;
		this.cjsj = cjsj;
		this.zhdlsj = zhdlsj;
		this.yy = yy;
		this.zh = zh;
		this.mm = mm;
		this.bs = bs;
		this.jbs = jbs;
		this.jb = jb;
		this.s = s;
		this.xld = xld;
		this.sb = sb;
		this.sbxt = sbxt;
		this.fbl = fbl;
		this.qd = qd;
		this.yhlx_id = yhlx_id;
		this.yhlvl = yhlvl;
		this.yhlvl_exp = yhlvl_exp;
		this.vIP = vIP;
		this.vIP_exp = vIP_exp;
		this.czje = czje;
		this.xy = xy;
		this.khdbb = khdbb;
		this.fwq_id = fwq_id;
		this.zclvl = zclvl;
		this.sd = sd;
		this.lm_id = lm_id;
		this._source = true;
	}
	
	public Map<String, Object> getUpdateColumns() {
		if(updateColumns == null)
			updateColumns = new HashMap<String, Object>();
		return updateColumns;
	}
	
	public void setUpdateColumns(Map<String, Object> updateColumns) {
		this.updateColumns = updateColumns;
	}
	
	public int getId() {
		return id;
	}
	
	public void setId(int id) {
		changeSetId(id);
		if(!this._source){
			byteBuff.writeInt(1);
			byteBuff.writeInt(id);
		}
	}
	
	private void changeSetId(int id) {
		this.id = id;
		if(!this._source){
			addUpdateColumn("id",id);
		}
	}
	
	public void changeIdWith(int id){
		this.id += id;
		changeSetId(this.id);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(2);
			byteBuff.writeInt(id);
		}
	}
	public void changeIdWithMin(int id,int min){
		this.id += id;
		this.id = this.id < min ? min : this.id;
		changeSetId(this.id);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(3);
			byteBuff.writeInt(id);
			byteBuff.writeInt(min);
		}	
	}
	public void changeIdWithMax(int id,int max){
		this.id += id;
		this.id = this.id > max ? max : this.id;
		changeSetId(this.id);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(4);
			byteBuff.writeInt(id);
			byteBuff.writeInt(max);
		}
	}
	public void changeIdWithMaxMin(int id,int max,int min){
		this.id += id;
		this.id = this.id < min ? min : this.id;
		this.id = this.id > max ? max : this.id;
		changeSetId(this.id);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(5);
			byteBuff.writeInt(id);
			byteBuff.writeInt(max);
			byteBuff.writeInt(min);
		}	
	}	
	public String getNc() {
		return nc;
	}
	
	public void setNc(String nc) {
		changeSetNc(nc);
		if(!this._source){
			byteBuff.writeInt(6);
			byteBuff.writeString(nc);
		}
	}
	
	private void changeSetNc(String nc) {
		this.nc = nc;
		if(!this._source){
			addUpdateColumn("昵称",nc);
		}
	}
	
	public java.util.Date getCjsj() {
		return cjsj;
	}
	
	public void setCjsj(java.util.Date cjsj) {
		changeSetCjsj(cjsj);
		if(!this._source){
			byteBuff.writeInt(7);
			byteBuff.writeDate(cjsj);
		}
	}
	
	private void changeSetCjsj(java.util.Date cjsj) {
		this.cjsj = cjsj;
		if(!this._source){
			addUpdateColumn("创建时间",cjsj);
		}
	}
	
	public java.util.Date getZhdlsj() {
		return zhdlsj;
	}
	
	public void setZhdlsj(java.util.Date zhdlsj) {
		changeSetZhdlsj(zhdlsj);
		if(!this._source){
			byteBuff.writeInt(8);
			byteBuff.writeDate(zhdlsj);
		}
	}
	
	private void changeSetZhdlsj(java.util.Date zhdlsj) {
		this.zhdlsj = zhdlsj;
		if(!this._source){
			addUpdateColumn("最后登录时间",zhdlsj);
		}
	}
	
	public String getYy() {
		return yy;
	}
	
	public void setYy(String yy) {
		changeSetYy(yy);
		if(!this._source){
			byteBuff.writeInt(9);
			byteBuff.writeString(yy);
		}
	}
	
	private void changeSetYy(String yy) {
		this.yy = yy;
		if(!this._source){
			addUpdateColumn("语言",yy);
		}
	}
	
	public String getZh() {
		return zh;
	}
	
	public void setZh(String zh) {
		changeSetZh(zh);
		if(!this._source){
			byteBuff.writeInt(10);
			byteBuff.writeString(zh);
		}
	}
	
	private void changeSetZh(String zh) {
		this.zh = zh;
		if(!this._source){
			addUpdateColumn("账号",zh);
		}
	}
	
	public String getMm() {
		return mm;
	}
	
	public void setMm(String mm) {
		changeSetMm(mm);
		if(!this._source){
			byteBuff.writeInt(11);
			byteBuff.writeString(mm);
		}
	}
	
	private void changeSetMm(String mm) {
		this.mm = mm;
		if(!this._source){
			addUpdateColumn("密码",mm);
		}
	}
	
	public int getBs() {
		return bs;
	}
	
	public void setBs(int bs) {
		changeSetBs(bs);
		if(!this._source){
			byteBuff.writeInt(12);
			byteBuff.writeInt(bs);
		}
	}
	
	private void changeSetBs(int bs) {
		this.bs = bs;
		if(!this._source){
			addUpdateColumn("宝石",bs);
		}
	}
	
	public void changeBsWith(int bs){
		this.bs += bs;
		changeSetBs(this.bs);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(13);
			byteBuff.writeInt(bs);
		}
	}
	public void changeBsWithMin(int bs,int min){
		this.bs += bs;
		this.bs = this.bs < min ? min : this.bs;
		changeSetBs(this.bs);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(14);
			byteBuff.writeInt(bs);
			byteBuff.writeInt(min);
		}	
	}
	public void changeBsWithMax(int bs,int max){
		this.bs += bs;
		this.bs = this.bs > max ? max : this.bs;
		changeSetBs(this.bs);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(15);
			byteBuff.writeInt(bs);
			byteBuff.writeInt(max);
		}
	}
	public void changeBsWithMaxMin(int bs,int max,int min){
		this.bs += bs;
		this.bs = this.bs < min ? min : this.bs;
		this.bs = this.bs > max ? max : this.bs;
		changeSetBs(this.bs);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(16);
			byteBuff.writeInt(bs);
			byteBuff.writeInt(max);
			byteBuff.writeInt(min);
		}	
	}	
	public int getJbs() {
		return jbs;
	}
	
	public void setJbs(int jbs) {
		changeSetJbs(jbs);
		if(!this._source){
			byteBuff.writeInt(17);
			byteBuff.writeInt(jbs);
		}
	}
	
	private void changeSetJbs(int jbs) {
		this.jbs = jbs;
		if(!this._source){
			addUpdateColumn("假宝石",jbs);
		}
	}
	
	public void changeJbsWith(int jbs){
		this.jbs += jbs;
		changeSetJbs(this.jbs);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(18);
			byteBuff.writeInt(jbs);
		}
	}
	public void changeJbsWithMin(int jbs,int min){
		this.jbs += jbs;
		this.jbs = this.jbs < min ? min : this.jbs;
		changeSetJbs(this.jbs);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(19);
			byteBuff.writeInt(jbs);
			byteBuff.writeInt(min);
		}	
	}
	public void changeJbsWithMax(int jbs,int max){
		this.jbs += jbs;
		this.jbs = this.jbs > max ? max : this.jbs;
		changeSetJbs(this.jbs);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(20);
			byteBuff.writeInt(jbs);
			byteBuff.writeInt(max);
		}
	}
	public void changeJbsWithMaxMin(int jbs,int max,int min){
		this.jbs += jbs;
		this.jbs = this.jbs < min ? min : this.jbs;
		this.jbs = this.jbs > max ? max : this.jbs;
		changeSetJbs(this.jbs);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(21);
			byteBuff.writeInt(jbs);
			byteBuff.writeInt(max);
			byteBuff.writeInt(min);
		}	
	}	
	public int getJb() {
		return jb;
	}
	
	public void setJb(int jb) {
		changeSetJb(jb);
		if(!this._source){
			byteBuff.writeInt(22);
			byteBuff.writeInt(jb);
		}
	}
	
	private void changeSetJb(int jb) {
		this.jb = jb;
		if(!this._source){
			addUpdateColumn("金币",jb);
		}
	}
	
	public void changeJbWith(int jb){
		this.jb += jb;
		changeSetJb(this.jb);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(23);
			byteBuff.writeInt(jb);
		}
	}
	public void changeJbWithMin(int jb,int min){
		this.jb += jb;
		this.jb = this.jb < min ? min : this.jb;
		changeSetJb(this.jb);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(24);
			byteBuff.writeInt(jb);
			byteBuff.writeInt(min);
		}	
	}
	public void changeJbWithMax(int jb,int max){
		this.jb += jb;
		this.jb = this.jb > max ? max : this.jb;
		changeSetJb(this.jb);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(25);
			byteBuff.writeInt(jb);
			byteBuff.writeInt(max);
		}
	}
	public void changeJbWithMaxMin(int jb,int max,int min){
		this.jb += jb;
		this.jb = this.jb < min ? min : this.jb;
		this.jb = this.jb > max ? max : this.jb;
		changeSetJb(this.jb);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(26);
			byteBuff.writeInt(jb);
			byteBuff.writeInt(max);
			byteBuff.writeInt(min);
		}	
	}	
	public int getS() {
		return s;
	}
	
	public void setS(int s) {
		changeSetS(s);
		if(!this._source){
			byteBuff.writeInt(27);
			byteBuff.writeInt(s);
		}
	}
	
	private void changeSetS(int s) {
		this.s = s;
		if(!this._source){
			addUpdateColumn("水",s);
		}
	}
	
	public void changeSWith(int s){
		this.s += s;
		changeSetS(this.s);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(28);
			byteBuff.writeInt(s);
		}
	}
	public void changeSWithMin(int s,int min){
		this.s += s;
		this.s = this.s < min ? min : this.s;
		changeSetS(this.s);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(29);
			byteBuff.writeInt(s);
			byteBuff.writeInt(min);
		}	
	}
	public void changeSWithMax(int s,int max){
		this.s += s;
		this.s = this.s > max ? max : this.s;
		changeSetS(this.s);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(30);
			byteBuff.writeInt(s);
			byteBuff.writeInt(max);
		}
	}
	public void changeSWithMaxMin(int s,int max,int min){
		this.s += s;
		this.s = this.s < min ? min : this.s;
		this.s = this.s > max ? max : this.s;
		changeSetS(this.s);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(31);
			byteBuff.writeInt(s);
			byteBuff.writeInt(max);
			byteBuff.writeInt(min);
		}	
	}	
	public int getXld() {
		return xld;
	}
	
	public void setXld(int xld) {
		changeSetXld(xld);
		if(!this._source){
			byteBuff.writeInt(32);
			byteBuff.writeInt(xld);
		}
	}
	
	private void changeSetXld(int xld) {
		this.xld = xld;
		if(!this._source){
			addUpdateColumn("修炼点",xld);
		}
	}
	
	public void changeXldWith(int xld){
		this.xld += xld;
		changeSetXld(this.xld);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(33);
			byteBuff.writeInt(xld);
		}
	}
	public void changeXldWithMin(int xld,int min){
		this.xld += xld;
		this.xld = this.xld < min ? min : this.xld;
		changeSetXld(this.xld);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(34);
			byteBuff.writeInt(xld);
			byteBuff.writeInt(min);
		}	
	}
	public void changeXldWithMax(int xld,int max){
		this.xld += xld;
		this.xld = this.xld > max ? max : this.xld;
		changeSetXld(this.xld);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(35);
			byteBuff.writeInt(xld);
			byteBuff.writeInt(max);
		}
	}
	public void changeXldWithMaxMin(int xld,int max,int min){
		this.xld += xld;
		this.xld = this.xld < min ? min : this.xld;
		this.xld = this.xld > max ? max : this.xld;
		changeSetXld(this.xld);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(36);
			byteBuff.writeInt(xld);
			byteBuff.writeInt(max);
			byteBuff.writeInt(min);
		}	
	}	
	public String getSb() {
		return sb;
	}
	
	public void setSb(String sb) {
		changeSetSb(sb);
		if(!this._source){
			byteBuff.writeInt(37);
			byteBuff.writeString(sb);
		}
	}
	
	private void changeSetSb(String sb) {
		this.sb = sb;
		if(!this._source){
			addUpdateColumn("设备",sb);
		}
	}
	
	public String getSbxt() {
		return sbxt;
	}
	
	public void setSbxt(String sbxt) {
		changeSetSbxt(sbxt);
		if(!this._source){
			byteBuff.writeInt(38);
			byteBuff.writeString(sbxt);
		}
	}
	
	private void changeSetSbxt(String sbxt) {
		this.sbxt = sbxt;
		if(!this._source){
			addUpdateColumn("设备系统",sbxt);
		}
	}
	
	public String getFbl() {
		return fbl;
	}
	
	public void setFbl(String fbl) {
		changeSetFbl(fbl);
		if(!this._source){
			byteBuff.writeInt(39);
			byteBuff.writeString(fbl);
		}
	}
	
	private void changeSetFbl(String fbl) {
		this.fbl = fbl;
		if(!this._source){
			addUpdateColumn("分辨率",fbl);
		}
	}
	
	public String getQd() {
		return qd;
	}
	
	public void setQd(String qd) {
		changeSetQd(qd);
		if(!this._source){
			byteBuff.writeInt(40);
			byteBuff.writeString(qd);
		}
	}
	
	private void changeSetQd(String qd) {
		this.qd = qd;
		if(!this._source){
			addUpdateColumn("渠道",qd);
		}
	}
	
	public int getYhlx_id() {
		return yhlx_id;
	}
	
	public void setYhlx_id(int yhlx_id) {
		changeSetYhlx_id(yhlx_id);
		if(!this._source){
			byteBuff.writeInt(41);
			byteBuff.writeInt(yhlx_id);
		}
	}
	
	private void changeSetYhlx_id(int yhlx_id) {
		this.yhlx_id = yhlx_id;
		if(!this._source){
			addUpdateColumn("用户类型_id",yhlx_id);
		}
	}
	
	public void changeYhlx_idWith(int yhlx_id){
		this.yhlx_id += yhlx_id;
		changeSetYhlx_id(this.yhlx_id);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(42);
			byteBuff.writeInt(yhlx_id);
		}
	}
	public void changeYhlx_idWithMin(int yhlx_id,int min){
		this.yhlx_id += yhlx_id;
		this.yhlx_id = this.yhlx_id < min ? min : this.yhlx_id;
		changeSetYhlx_id(this.yhlx_id);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(43);
			byteBuff.writeInt(yhlx_id);
			byteBuff.writeInt(min);
		}	
	}
	public void changeYhlx_idWithMax(int yhlx_id,int max){
		this.yhlx_id += yhlx_id;
		this.yhlx_id = this.yhlx_id > max ? max : this.yhlx_id;
		changeSetYhlx_id(this.yhlx_id);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(44);
			byteBuff.writeInt(yhlx_id);
			byteBuff.writeInt(max);
		}
	}
	public void changeYhlx_idWithMaxMin(int yhlx_id,int max,int min){
		this.yhlx_id += yhlx_id;
		this.yhlx_id = this.yhlx_id < min ? min : this.yhlx_id;
		this.yhlx_id = this.yhlx_id > max ? max : this.yhlx_id;
		changeSetYhlx_id(this.yhlx_id);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(45);
			byteBuff.writeInt(yhlx_id);
			byteBuff.writeInt(max);
			byteBuff.writeInt(min);
		}	
	}	
	public int getYhlvl() {
		return yhlvl;
	}
	
	public void setYhlvl(int yhlvl) {
		changeSetYhlvl(yhlvl);
		if(!this._source){
			byteBuff.writeInt(46);
			byteBuff.writeInt(yhlvl);
		}
	}
	
	private void changeSetYhlvl(int yhlvl) {
		this.yhlvl = yhlvl;
		if(!this._source){
			addUpdateColumn("用户lvl",yhlvl);
		}
	}
	
	public void changeYhlvlWith(int yhlvl){
		this.yhlvl += yhlvl;
		changeSetYhlvl(this.yhlvl);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(47);
			byteBuff.writeInt(yhlvl);
		}
	}
	public void changeYhlvlWithMin(int yhlvl,int min){
		this.yhlvl += yhlvl;
		this.yhlvl = this.yhlvl < min ? min : this.yhlvl;
		changeSetYhlvl(this.yhlvl);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(48);
			byteBuff.writeInt(yhlvl);
			byteBuff.writeInt(min);
		}	
	}
	public void changeYhlvlWithMax(int yhlvl,int max){
		this.yhlvl += yhlvl;
		this.yhlvl = this.yhlvl > max ? max : this.yhlvl;
		changeSetYhlvl(this.yhlvl);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(49);
			byteBuff.writeInt(yhlvl);
			byteBuff.writeInt(max);
		}
	}
	public void changeYhlvlWithMaxMin(int yhlvl,int max,int min){
		this.yhlvl += yhlvl;
		this.yhlvl = this.yhlvl < min ? min : this.yhlvl;
		this.yhlvl = this.yhlvl > max ? max : this.yhlvl;
		changeSetYhlvl(this.yhlvl);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(50);
			byteBuff.writeInt(yhlvl);
			byteBuff.writeInt(max);
			byteBuff.writeInt(min);
		}	
	}	
	public int getYhlvl_exp() {
		return yhlvl_exp;
	}
	
	public void setYhlvl_exp(int yhlvl_exp) {
		changeSetYhlvl_exp(yhlvl_exp);
		if(!this._source){
			byteBuff.writeInt(51);
			byteBuff.writeInt(yhlvl_exp);
		}
	}
	
	private void changeSetYhlvl_exp(int yhlvl_exp) {
		this.yhlvl_exp = yhlvl_exp;
		if(!this._source){
			addUpdateColumn("用户lvl_exp",yhlvl_exp);
		}
	}
	
	public void changeYhlvl_expWith(int yhlvl_exp){
		this.yhlvl_exp += yhlvl_exp;
		changeSetYhlvl_exp(this.yhlvl_exp);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(52);
			byteBuff.writeInt(yhlvl_exp);
		}
	}
	public void changeYhlvl_expWithMin(int yhlvl_exp,int min){
		this.yhlvl_exp += yhlvl_exp;
		this.yhlvl_exp = this.yhlvl_exp < min ? min : this.yhlvl_exp;
		changeSetYhlvl_exp(this.yhlvl_exp);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(53);
			byteBuff.writeInt(yhlvl_exp);
			byteBuff.writeInt(min);
		}	
	}
	public void changeYhlvl_expWithMax(int yhlvl_exp,int max){
		this.yhlvl_exp += yhlvl_exp;
		this.yhlvl_exp = this.yhlvl_exp > max ? max : this.yhlvl_exp;
		changeSetYhlvl_exp(this.yhlvl_exp);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(54);
			byteBuff.writeInt(yhlvl_exp);
			byteBuff.writeInt(max);
		}
	}
	public void changeYhlvl_expWithMaxMin(int yhlvl_exp,int max,int min){
		this.yhlvl_exp += yhlvl_exp;
		this.yhlvl_exp = this.yhlvl_exp < min ? min : this.yhlvl_exp;
		this.yhlvl_exp = this.yhlvl_exp > max ? max : this.yhlvl_exp;
		changeSetYhlvl_exp(this.yhlvl_exp);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(55);
			byteBuff.writeInt(yhlvl_exp);
			byteBuff.writeInt(max);
			byteBuff.writeInt(min);
		}	
	}	
	public int getVIP() {
		return vIP;
	}
	
	public void setVIP(int vIP) {
		changeSetVIP(vIP);
		if(!this._source){
			byteBuff.writeInt(56);
			byteBuff.writeInt(vIP);
		}
	}
	
	private void changeSetVIP(int vIP) {
		this.vIP = vIP;
		if(!this._source){
			addUpdateColumn("VIP",vIP);
		}
	}
	
	public void changeVIPWith(int vIP){
		this.vIP += vIP;
		changeSetVIP(this.vIP);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(57);
			byteBuff.writeInt(vIP);
		}
	}
	public void changeVIPWithMin(int vIP,int min){
		this.vIP += vIP;
		this.vIP = this.vIP < min ? min : this.vIP;
		changeSetVIP(this.vIP);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(58);
			byteBuff.writeInt(vIP);
			byteBuff.writeInt(min);
		}	
	}
	public void changeVIPWithMax(int vIP,int max){
		this.vIP += vIP;
		this.vIP = this.vIP > max ? max : this.vIP;
		changeSetVIP(this.vIP);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(59);
			byteBuff.writeInt(vIP);
			byteBuff.writeInt(max);
		}
	}
	public void changeVIPWithMaxMin(int vIP,int max,int min){
		this.vIP += vIP;
		this.vIP = this.vIP < min ? min : this.vIP;
		this.vIP = this.vIP > max ? max : this.vIP;
		changeSetVIP(this.vIP);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(60);
			byteBuff.writeInt(vIP);
			byteBuff.writeInt(max);
			byteBuff.writeInt(min);
		}	
	}	
	public int getVIP_exp() {
		return vIP_exp;
	}
	
	public void setVIP_exp(int vIP_exp) {
		changeSetVIP_exp(vIP_exp);
		if(!this._source){
			byteBuff.writeInt(61);
			byteBuff.writeInt(vIP_exp);
		}
	}
	
	private void changeSetVIP_exp(int vIP_exp) {
		this.vIP_exp = vIP_exp;
		if(!this._source){
			addUpdateColumn("VIP_exp",vIP_exp);
		}
	}
	
	public void changeVIP_expWith(int vIP_exp){
		this.vIP_exp += vIP_exp;
		changeSetVIP_exp(this.vIP_exp);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(62);
			byteBuff.writeInt(vIP_exp);
		}
	}
	public void changeVIP_expWithMin(int vIP_exp,int min){
		this.vIP_exp += vIP_exp;
		this.vIP_exp = this.vIP_exp < min ? min : this.vIP_exp;
		changeSetVIP_exp(this.vIP_exp);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(63);
			byteBuff.writeInt(vIP_exp);
			byteBuff.writeInt(min);
		}	
	}
	public void changeVIP_expWithMax(int vIP_exp,int max){
		this.vIP_exp += vIP_exp;
		this.vIP_exp = this.vIP_exp > max ? max : this.vIP_exp;
		changeSetVIP_exp(this.vIP_exp);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(64);
			byteBuff.writeInt(vIP_exp);
			byteBuff.writeInt(max);
		}
	}
	public void changeVIP_expWithMaxMin(int vIP_exp,int max,int min){
		this.vIP_exp += vIP_exp;
		this.vIP_exp = this.vIP_exp < min ? min : this.vIP_exp;
		this.vIP_exp = this.vIP_exp > max ? max : this.vIP_exp;
		changeSetVIP_exp(this.vIP_exp);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(65);
			byteBuff.writeInt(vIP_exp);
			byteBuff.writeInt(max);
			byteBuff.writeInt(min);
		}	
	}	
	public int getCzje() {
		return czje;
	}
	
	public void setCzje(int czje) {
		changeSetCzje(czje);
		if(!this._source){
			byteBuff.writeInt(66);
			byteBuff.writeInt(czje);
		}
	}
	
	private void changeSetCzje(int czje) {
		this.czje = czje;
		if(!this._source){
			addUpdateColumn("充值金额",czje);
		}
	}
	
	public void changeCzjeWith(int czje){
		this.czje += czje;
		changeSetCzje(this.czje);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(67);
			byteBuff.writeInt(czje);
		}
	}
	public void changeCzjeWithMin(int czje,int min){
		this.czje += czje;
		this.czje = this.czje < min ? min : this.czje;
		changeSetCzje(this.czje);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(68);
			byteBuff.writeInt(czje);
			byteBuff.writeInt(min);
		}	
	}
	public void changeCzjeWithMax(int czje,int max){
		this.czje += czje;
		this.czje = this.czje > max ? max : this.czje;
		changeSetCzje(this.czje);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(69);
			byteBuff.writeInt(czje);
			byteBuff.writeInt(max);
		}
	}
	public void changeCzjeWithMaxMin(int czje,int max,int min){
		this.czje += czje;
		this.czje = this.czje < min ? min : this.czje;
		this.czje = this.czje > max ? max : this.czje;
		changeSetCzje(this.czje);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(70);
			byteBuff.writeInt(czje);
			byteBuff.writeInt(max);
			byteBuff.writeInt(min);
		}	
	}	
	public int getXy() {
		return xy;
	}
	
	public void setXy(int xy) {
		changeSetXy(xy);
		if(!this._source){
			byteBuff.writeInt(71);
			byteBuff.writeInt(xy);
		}
	}
	
	private void changeSetXy(int xy) {
		this.xy = xy;
		if(!this._source){
			addUpdateColumn("幸运",xy);
		}
	}
	
	public void changeXyWith(int xy){
		this.xy += xy;
		changeSetXy(this.xy);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(72);
			byteBuff.writeInt(xy);
		}
	}
	public void changeXyWithMin(int xy,int min){
		this.xy += xy;
		this.xy = this.xy < min ? min : this.xy;
		changeSetXy(this.xy);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(73);
			byteBuff.writeInt(xy);
			byteBuff.writeInt(min);
		}	
	}
	public void changeXyWithMax(int xy,int max){
		this.xy += xy;
		this.xy = this.xy > max ? max : this.xy;
		changeSetXy(this.xy);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(74);
			byteBuff.writeInt(xy);
			byteBuff.writeInt(max);
		}
	}
	public void changeXyWithMaxMin(int xy,int max,int min){
		this.xy += xy;
		this.xy = this.xy < min ? min : this.xy;
		this.xy = this.xy > max ? max : this.xy;
		changeSetXy(this.xy);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(75);
			byteBuff.writeInt(xy);
			byteBuff.writeInt(max);
			byteBuff.writeInt(min);
		}	
	}	
	public String getKhdbb() {
		return khdbb;
	}
	
	public void setKhdbb(String khdbb) {
		changeSetKhdbb(khdbb);
		if(!this._source){
			byteBuff.writeInt(76);
			byteBuff.writeString(khdbb);
		}
	}
	
	private void changeSetKhdbb(String khdbb) {
		this.khdbb = khdbb;
		if(!this._source){
			addUpdateColumn("客户端版本",khdbb);
		}
	}
	
	public int getFwq_id() {
		return fwq_id;
	}
	
	public void setFwq_id(int fwq_id) {
		changeSetFwq_id(fwq_id);
		if(!this._source){
			byteBuff.writeInt(77);
			byteBuff.writeInt(fwq_id);
		}
	}
	
	private void changeSetFwq_id(int fwq_id) {
		this.fwq_id = fwq_id;
		if(!this._source){
			addUpdateColumn("服务器_id",fwq_id);
		}
	}
	
	public void changeFwq_idWith(int fwq_id){
		this.fwq_id += fwq_id;
		changeSetFwq_id(this.fwq_id);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(78);
			byteBuff.writeInt(fwq_id);
		}
	}
	public void changeFwq_idWithMin(int fwq_id,int min){
		this.fwq_id += fwq_id;
		this.fwq_id = this.fwq_id < min ? min : this.fwq_id;
		changeSetFwq_id(this.fwq_id);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(79);
			byteBuff.writeInt(fwq_id);
			byteBuff.writeInt(min);
		}	
	}
	public void changeFwq_idWithMax(int fwq_id,int max){
		this.fwq_id += fwq_id;
		this.fwq_id = this.fwq_id > max ? max : this.fwq_id;
		changeSetFwq_id(this.fwq_id);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(80);
			byteBuff.writeInt(fwq_id);
			byteBuff.writeInt(max);
		}
	}
	public void changeFwq_idWithMaxMin(int fwq_id,int max,int min){
		this.fwq_id += fwq_id;
		this.fwq_id = this.fwq_id < min ? min : this.fwq_id;
		this.fwq_id = this.fwq_id > max ? max : this.fwq_id;
		changeSetFwq_id(this.fwq_id);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(81);
			byteBuff.writeInt(fwq_id);
			byteBuff.writeInt(max);
			byteBuff.writeInt(min);
		}	
	}	
	public int getZclvl() {
		return zclvl;
	}
	
	public void setZclvl(int zclvl) {
		changeSetZclvl(zclvl);
		if(!this._source){
			byteBuff.writeInt(82);
			byteBuff.writeInt(zclvl);
		}
	}
	
	private void changeSetZclvl(int zclvl) {
		this.zclvl = zclvl;
		if(!this._source){
			addUpdateColumn("主城lvl",zclvl);
		}
	}
	
	public void changeZclvlWith(int zclvl){
		this.zclvl += zclvl;
		changeSetZclvl(this.zclvl);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(83);
			byteBuff.writeInt(zclvl);
		}
	}
	public void changeZclvlWithMin(int zclvl,int min){
		this.zclvl += zclvl;
		this.zclvl = this.zclvl < min ? min : this.zclvl;
		changeSetZclvl(this.zclvl);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(84);
			byteBuff.writeInt(zclvl);
			byteBuff.writeInt(min);
		}	
	}
	public void changeZclvlWithMax(int zclvl,int max){
		this.zclvl += zclvl;
		this.zclvl = this.zclvl > max ? max : this.zclvl;
		changeSetZclvl(this.zclvl);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(85);
			byteBuff.writeInt(zclvl);
			byteBuff.writeInt(max);
		}
	}
	public void changeZclvlWithMaxMin(int zclvl,int max,int min){
		this.zclvl += zclvl;
		this.zclvl = this.zclvl < min ? min : this.zclvl;
		this.zclvl = this.zclvl > max ? max : this.zclvl;
		changeSetZclvl(this.zclvl);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(86);
			byteBuff.writeInt(zclvl);
			byteBuff.writeInt(max);
			byteBuff.writeInt(min);
		}	
	}	
	public boolean getSd() {
		return sd;
	}
	
	public void setSd(boolean sd) {
		changeSetSd(sd);
		if(!this._source){
			byteBuff.writeInt(87);
		}
	}
	
	private void changeSetSd(boolean sd) {
		this.sd = sd;
		if(!this._source){
			addUpdateColumn("锁定",sd);
		}
	}
	
	public int getLm_id() {
		return lm_id;
	}
	
	public void setLm_id(int lm_id) {
		changeSetLm_id(lm_id);
		if(!this._source){
			byteBuff.writeInt(88);
			byteBuff.writeInt(lm_id);
		}
	}
	
	private void changeSetLm_id(int lm_id) {
		this.lm_id = lm_id;
		if(!this._source){
			addUpdateColumn("联盟_id",lm_id);
		}
	}
	
	public void changeLm_idWith(int lm_id){
		this.lm_id += lm_id;
		changeSetLm_id(this.lm_id);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(89);
			byteBuff.writeInt(lm_id);
		}
	}
	public void changeLm_idWithMin(int lm_id,int min){
		this.lm_id += lm_id;
		this.lm_id = this.lm_id < min ? min : this.lm_id;
		changeSetLm_id(this.lm_id);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(90);
			byteBuff.writeInt(lm_id);
			byteBuff.writeInt(min);
		}	
	}
	public void changeLm_idWithMax(int lm_id,int max){
		this.lm_id += lm_id;
		this.lm_id = this.lm_id > max ? max : this.lm_id;
		changeSetLm_id(this.lm_id);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(91);
			byteBuff.writeInt(lm_id);
			byteBuff.writeInt(max);
		}
	}
	public void changeLm_idWithMaxMin(int lm_id,int max,int min){
		this.lm_id += lm_id;
		this.lm_id = this.lm_id < min ? min : this.lm_id;
		this.lm_id = this.lm_id > max ? max : this.lm_id;
		changeSetLm_id(this.lm_id);
		//不是源对象才记录变更操作
		if(!this._source){
			byteBuff.writeInt(92);
			byteBuff.writeInt(lm_id);
			byteBuff.writeInt(max);
			byteBuff.writeInt(min);
		}	
	}	
	
	//id
	public List<Yhjz> getYhjzsFkYh_id(){
		return YhjzImp.getByYh_id(id);
	}
	
	//id
	public List<Yhys> getYhyssFkYh_id(){
		return YhysImp.getByYh_id(id);
	}
	
	//id
	public List<Yhbb> getYhbbsFkYh_id(){
		return YhbbImp.getByYh_id(id);
	}
	
	//id
	public List<Yhyx> getYhyxsFkYh_id(){
		return YhyxImp.getByYh_id(id);
	}
	
	//id
	public List<Yhzs> getYhzssFkYh_id(){
		return YhzsImp.getByYh_id(id);
	}
	
	//id
	public List<Yhyj> getYhyjsFkFjrid(){
		return YhyjImp.getByFjrid(id);
	}
	
	//id
	public List<Yhyj> getYhyjsFkJsrid(){
		return YhyjImp.getByJsrid(id);
	}
	
	//id
	public List<Yhxj> getYhxjsFkYh_id(){
		return YhxjImp.getByYh_id(id);
	}
	
	//id
	public List<Yhza> getYhzasFkYh_id(){
		return YhzaImp.getByYh_id(id);
	}
	
	//id
	public List<Lt> getLtsFkJsrid(){
		return LtImp.getByJsrid(id);
	}
	
	//id
	public List<Lt> getLtsFkFyrid(){
		return LtImp.getByFyrid(id);
	}
	
	//id
	public List<Lm> getLmsFkCjrid(){
		return LmImp.getByCjrid(id);
	}
	
	//服务器_id
	public Fwq getFwqPkFwq_id(){
		return FwqImp.getById(fwq_id);
	}
	//用户类型_id
	public Yhlx getYhlxPkYhlx_id(){
		return YhlxImp.getById(yhlx_id);
	}
	//联盟_id
	public Lm getLmPkLm_id(){
		return LmImp.getById(lm_id);
	}
	public void addUpdateColumn(String key, Object val) {
		Map<String, Object> map = getUpdateColumns();
		if (map == null)
			return;
		map.put(key, val);
	}
	/**
	public void clearUpdateColumn() {
		Map<String, Object> map = getUpdateColumns();
		if (map == null)
			return;
		map.clear();
	}
	*/
	public Yh clone(){
		Yh yh = new Yh();
		yh.setId(this.getId());
		yh.setNc(this.getNc());
		yh.setCjsj(this.getCjsj());
		yh.setZhdlsj(this.getZhdlsj());
		yh.setYy(this.getYy());
		yh.setZh(this.getZh());
		yh.setMm(this.getMm());
		yh.setBs(this.getBs());
		yh.setJbs(this.getJbs());
		yh.setJb(this.getJb());
		yh.setS(this.getS());
		yh.setXld(this.getXld());
		yh.setSb(this.getSb());
		yh.setSbxt(this.getSbxt());
		yh.setFbl(this.getFbl());
		yh.setQd(this.getQd());
		yh.setYhlx_id(this.getYhlx_id());
		yh.setYhlvl(this.getYhlvl());
		yh.setYhlvl_exp(this.getYhlvl_exp());
		yh.setVIP(this.getVIP());
		yh.setVIP_exp(this.getVIP_exp());
		yh.setCzje(this.getCzje());
		yh.setXy(this.getXy());
		yh.setKhdbb(this.getKhdbb());
		yh.setFwq_id(this.getFwq_id());
		yh.setZclvl(this.getZclvl());
		yh.setSd(this.getSd());
		yh.setLm_id(this.getLm_id());
		yh._v = _v;
		yh._source = false;
		return yh.updatePrimaryIndex(); 
	}
	
	public Map<String, Object> toMap(){
        Map<String, Object> result = new HashMap<String, Object>();
        result.put("id", this.id);
        result.put("nc", this.nc);
        result.put("cjsj", this.cjsj);
        result.put("zhdlsj", this.zhdlsj);
        result.put("yy", this.yy);
        result.put("zh", this.zh);
        result.put("mm", this.mm);
        result.put("bs", this.bs);
        result.put("jbs", this.jbs);
        result.put("jb", this.jb);
        result.put("s", this.s);
        result.put("xld", this.xld);
        result.put("sb", this.sb);
        result.put("sbxt", this.sbxt);
        result.put("fbl", this.fbl);
        result.put("qd", this.qd);
        result.put("yhlx_id", this.yhlx_id);
        result.put("yhlvl", this.yhlvl);
        result.put("yhlvl_exp", this.yhlvl_exp);
        result.put("vIP", this.vIP);
        result.put("vIP_exp", this.vIP_exp);
        result.put("czje", this.czje);
        result.put("xy", this.xy);
        result.put("khdbb", this.khdbb);
        result.put("fwq_id", this.fwq_id);
        result.put("zclvl", this.zclvl);
        result.put("sd", this.sd);
        result.put("lm_id", this.lm_id);
        return result;
    }
    
    public String toString(){
        return toMap().toString();
    }
    
    public String toJson(){
    	return JSON.toJSONString(toMap());
    }
    
    /**
     * 数据库源字段Map
     */
    public Map<String, Object> toColumnNameMap(){
        Map<String, Object> result = new HashMap<String, Object>();
        result.put("id", this.id);
        result.put("昵称", this.nc);
        result.put("创建时间", this.cjsj);
        result.put("最后登录时间", this.zhdlsj);
        result.put("语言", this.yy);
        result.put("账号", this.zh);
        result.put("密码", this.mm);
        result.put("宝石", this.bs);
        result.put("假宝石", this.jbs);
        result.put("金币", this.jb);
        result.put("水", this.s);
        result.put("修炼点", this.xld);
        result.put("设备", this.sb);
        result.put("设备系统", this.sbxt);
        result.put("分辨率", this.fbl);
        result.put("渠道", this.qd);
        result.put("用户类型_id", this.yhlx_id);
        result.put("用户lvl", this.yhlvl);
        result.put("用户lvl_exp", this.yhlvl_exp);
        result.put("VIP", this.vIP);
        result.put("VIP_exp", this.vIP_exp);
        result.put("充值金额", this.czje);
        result.put("幸运", this.xy);
        result.put("客户端版本", this.khdbb);
        result.put("服务器_id", this.fwq_id);
        result.put("主城lvl", this.zclvl);
        result.put("锁定", this.sd);
        result.put("联盟_id", this.lm_id);
        return result;
    }
    
    public String toColumnNameString(){
        return toColumnNameMap().toString();
    }
    
    public byte[] toBytes() throws Exception {
    	SK_ByteBuff byteBuff = SK_ByteBuff.allocate();
	    byteBuff.writeInt(this.id);
	    byteBuff.writeString(this.nc);
	    byteBuff.writeDate(this.cjsj);
	    byteBuff.writeDate(this.zhdlsj);
	    byteBuff.writeString(this.yy);
	    byteBuff.writeString(this.zh);
	    byteBuff.writeString(this.mm);
	    byteBuff.writeInt(this.bs);
	    byteBuff.writeInt(this.jbs);
	    byteBuff.writeInt(this.jb);
	    byteBuff.writeInt(this.s);
	    byteBuff.writeInt(this.xld);
	    byteBuff.writeString(this.sb);
	    byteBuff.writeString(this.sbxt);
	    byteBuff.writeString(this.fbl);
	    byteBuff.writeString(this.qd);
	    byteBuff.writeInt(this.yhlx_id);
	    byteBuff.writeInt(this.yhlvl);
	    byteBuff.writeInt(this.yhlvl_exp);
	    byteBuff.writeInt(this.vIP);
	    byteBuff.writeInt(this.vIP_exp);
	    byteBuff.writeInt(this.czje);
	    byteBuff.writeInt(this.xy);
	    byteBuff.writeString(this.khdbb);
	    byteBuff.writeInt(this.fwq_id);
	    byteBuff.writeInt(this.zclvl);
	    byteBuff.writeInt(this.lm_id);
	    return byteBuff.toByte();
    }
    
    public byte[] toSKBytes(){
    	SK_ByteBuff byteBuff = SK_ByteBuff.allocate();
    	byteBuff.writeMap(toMap());
	    return byteBuff.toByte();
    }
    
     public static Yh createForBytes(byte[] _byte) throws Exception {
     	SK_ByteBuff byteBuff = SK_ByteBuff.wrap(_byte);
     	Yh yh = new Yh();
	    yh.id = byteBuff.readInt(null);
	    yh.nc = byteBuff.readString(null);
	    yh.cjsj = byteBuff.readDate(null);
	    yh.zhdlsj = byteBuff.readDate(null);
	    yh.yy = byteBuff.readString(null);
	    yh.zh = byteBuff.readString(null);
	    yh.mm = byteBuff.readString(null);
	    yh.bs = byteBuff.readInt(null);
	    yh.jbs = byteBuff.readInt(null);
	    yh.jb = byteBuff.readInt(null);
	    yh.s = byteBuff.readInt(null);
	    yh.xld = byteBuff.readInt(null);
	    yh.sb = byteBuff.readString(null);
	    yh.sbxt = byteBuff.readString(null);
	    yh.fbl = byteBuff.readString(null);
	    yh.qd = byteBuff.readString(null);
	    yh.yhlx_id = byteBuff.readInt(null);
	    yh.yhlvl = byteBuff.readInt(null);
	    yh.yhlvl_exp = byteBuff.readInt(null);
	    yh.vIP = byteBuff.readInt(null);
	    yh.vIP_exp = byteBuff.readInt(null);
	    yh.czje = byteBuff.readInt(null);
	    yh.xy = byteBuff.readInt(null);
	    yh.khdbb = byteBuff.readString(null);
	    yh.fwq_id = byteBuff.readInt(null);
	    yh.zclvl = byteBuff.readInt(null);
	    yh.lm_id = byteBuff.readInt(null);
	    return yh.updatePrimaryIndex();
     }
     
     public static Yh createForSKBytes(byte[] _byte){
     		SK_ByteBuff byteBuff = SK_ByteBuff.wrap(_byte);
     		@SuppressWarnings("unchecked")
     		Map<String,Object> map = byteBuff.readMap(null);
	     	Yh yh = Yh.createForMap(map);
		    return yh.updatePrimaryIndex();
     }
    
    /**
     * 根据list创建对象
     */
    public static List<Yh> createForColumnNameList(List<Map<String, Object>> list){
    	List<Yh> yhs = new ArrayList<Yh>();
		for (Map<String, Object> map : list) {
			yhs.add(createForColumnNameMap(map));
		}
		return yhs;
    }
    
    /**
     * 根据map创建对象
     */
    public static Yh createForColumnNameMap(Map<String, Object> map){
    	Yh obj = new Yh();
	    obj.id = SK_Map.getInt("id", map);
	    obj.nc = SK_Map.getString("昵称", map);
	    obj.cjsj = SK_Map.getDate("创建时间", map);
	    obj.zhdlsj = SK_Map.getDate("最后登录时间", map);
	    obj.yy = SK_Map.getString("语言", map);
	    obj.zh = SK_Map.getString("账号", map);
	    obj.mm = SK_Map.getString("密码", map);
	    obj.bs = SK_Map.getInt("宝石", map);
	    obj.jbs = SK_Map.getInt("假宝石", map);
	    obj.jb = SK_Map.getInt("金币", map);
	    obj.s = SK_Map.getInt("水", map);
	    obj.xld = SK_Map.getInt("修炼点", map);
	    obj.sb = SK_Map.getString("设备", map);
	    obj.sbxt = SK_Map.getString("设备系统", map);
	    obj.fbl = SK_Map.getString("分辨率", map);
	    obj.qd = SK_Map.getString("渠道", map);
	    obj.yhlx_id = SK_Map.getInt("用户类型_id", map);
	    obj.yhlvl = SK_Map.getInt("用户lvl", map);
	    obj.yhlvl_exp = SK_Map.getInt("用户lvl_exp", map);
	    obj.vIP = SK_Map.getInt("VIP", map);
	    obj.vIP_exp = SK_Map.getInt("VIP_exp", map);
	    obj.czje = SK_Map.getInt("充值金额", map);
	    obj.xy = SK_Map.getInt("幸运", map);
	    obj.khdbb = SK_Map.getString("客户端版本", map);
	    obj.fwq_id = SK_Map.getInt("服务器_id", map);
	    obj.zclvl = SK_Map.getInt("主城lvl", map);
	    obj.lm_id = SK_Map.getInt("联盟_id", map);
        return obj.updatePrimaryIndex();
    }
    
    /**
     * 根据list创建对象
     */
    public static List<Yh> createForList(List<Map<String, Object>> list){
    	List<Yh> yhs = new ArrayList<Yh>();
		for (Map<String, Object> map : list) {
			yhs.add(createForColumnNameMap(map));
		}
		return yhs;
    }
    
    /**
     * 根据map创建对象
     */
    public static Yh createForMap(Map<String, Object> map){
    	Yh obj = new Yh();
	    obj.id = SK_Map.getInt("id", map);
	    obj.nc = SK_Map.getString("nc", map);
	    obj.cjsj = SK_Map.getDate("cjsj", map);
	    obj.zhdlsj = SK_Map.getDate("zhdlsj", map);
	    obj.yy = SK_Map.getString("yy", map);
	    obj.zh = SK_Map.getString("zh", map);
	    obj.mm = SK_Map.getString("mm", map);
	    obj.bs = SK_Map.getInt("bs", map);
	    obj.jbs = SK_Map.getInt("jbs", map);
	    obj.jb = SK_Map.getInt("jb", map);
	    obj.s = SK_Map.getInt("s", map);
	    obj.xld = SK_Map.getInt("xld", map);
	    obj.sb = SK_Map.getString("sb", map);
	    obj.sbxt = SK_Map.getString("sbxt", map);
	    obj.fbl = SK_Map.getString("fbl", map);
	    obj.qd = SK_Map.getString("qd", map);
	    obj.yhlx_id = SK_Map.getInt("yhlx_id", map);
	    obj.yhlvl = SK_Map.getInt("yhlvl", map);
	    obj.yhlvl_exp = SK_Map.getInt("yhlvl_exp", map);
	    obj.vIP = SK_Map.getInt("vIP", map);
	    obj.vIP_exp = SK_Map.getInt("vIP_exp", map);
	    obj.czje = SK_Map.getInt("czje", map);
	    obj.xy = SK_Map.getInt("xy", map);
	    obj.khdbb = SK_Map.getString("khdbb", map);
	    obj.fwq_id = SK_Map.getInt("fwq_id", map);
	    obj.zclvl = SK_Map.getInt("zclvl", map);
	    obj.lm_id = SK_Map.getInt("lm_id", map);
        return obj.updatePrimaryIndex();
    }
    
    public static Yh createForJson(String json){
    	Map<String, Object> map = JSON.parseObject(json);
    	return createForMap(map);
    }
    
    public static List<Yh> createForJson(List<String> jsons){
    	List<Yh> yhs = new ArrayList<Yh>();
    	for(String json : jsons){
    		yhs.add(createForJson(json));
    	}
    	return yhs;
    }
    
    /** 级联删除(延迟入库) */
    public boolean deleteAndSon(){
    	return false;
    }
    
    /** 级联删除(及时入库) */
    public boolean deleteAndSonAndFlush(){
    	return false;
    }
    
    /** 延迟插入数据库 */
    public Yh insert(){
    	return YhImp.insert(this);
    }
    /** 延迟更新数据库 */
    public Yh update(){
    	return YhImp.update(this);
    }
    /** 延迟删除数据库 */
    public boolean delete(){
    	return YhImp.delete(this);
    }
    /** 即时插入数据库 */
    public Yh insertAndFlush(){
    	return YhImp.insertAndFlush(this);
    }
    /** 即时更新数据库 */
    public Yh updateAndFlush(){
    	return YhImp.updateAndFlush(this);
    }
    /** 即时删除数据库 */
    public boolean deleteAndFlush(){
    	return YhImp.deleteAndFlush(this);
    }
    
    
    
    //--------------------------------Cache 中的索引 GET & SET
	public String getId_Unique(){
		return id_Unique;
	}
	
	public void setId_Unique(String id_Unique){
		this.id_Unique = id_Unique;
	}
	
	public String getNc_Unique(){
		return nc_Unique;
	}
	
	public void setNc_Unique(String nc_Unique){
		this.nc_Unique = nc_Unique;
	}
	
	public String getZh_Unique(){
		return zh_Unique;
	}
	
	public void setZh_Unique(String zh_Unique){
		this.zh_Unique = zh_Unique;
	}
	
	public String getZhMm_Unique(){
		return zhmm_Unique;
	}
	
	public void setZhMm_Unique(String zhmm_Unique){
		this.zhmm_Unique = zhmm_Unique;
	}
	
	public String getYhlx_id_Index(){
		return yhlx_id_Index;
	}
	
	public void setYhlx_id_Index(String yhlx_id_Index){
		this.yhlx_id_Index = yhlx_id_Index;
	}
	
	public String getFwq_id_Index(){
		return fwq_id_Index;
	}
	
	public void setFwq_id_Index(String fwq_id_Index){
		this.fwq_id_Index = fwq_id_Index;
	}
	
	public String getQd_Index(){
		return qd_Index;
	}
	
	public void setQd_Index(String qd_Index){
		this.qd_Index = qd_Index;
	}
	
	public String getLm_id_Index(){
		return lm_id_Index;
	}
	
	public void setLm_id_Index(String lm_id_Index){
		this.lm_id_Index = lm_id_Index;
	}
	
	public String getQdYhlx_id_Index(){
		return qdyhlx_id_Index;
	}
	
	public void setQdYhlx_id_Index(String qdyhlx_id_Index){
		this.qdyhlx_id_Index = qdyhlx_id_Index;
	}
	
	
	
	/** 取得改变的索引 */
	public Map<String,String> getUpdateIndexs(){
		Map<String,String> indexNames = new HashMap<String,String>();
		if(!this.getId_Unique().equals(SK_Plus.b(id).e())){
			indexNames.put(Yh.Id_IndexName,SK_Plus.b(id).e());
			indexNames.put("isUpdtaeUnique","true");
		}
			
		if(!this.getNc_Unique().equals(SK_Plus.b(nc).e())){
			indexNames.put(Yh.Nc_IndexName,SK_Plus.b(nc).e());
			indexNames.put("isUpdtaeUnique","true");
		}
			
		if(!this.getZh_Unique().equals(SK_Plus.b(zh).e())){
			indexNames.put(Yh.Zh_IndexName,SK_Plus.b(zh).e());
			indexNames.put("isUpdtaeUnique","true");
		}
			
		if(!this.getZhMm_Unique().equals(SK_Plus.b(zh,"_",mm).e())){
			indexNames.put(Yh.ZhMm_IndexName,SK_Plus.b(zh,"_",mm).e());
			indexNames.put("isUpdtaeUnique","true");
		}
			
		if(!this.getYhlx_id_Index().equals(SK_Plus.b(yhlx_id).e()))
			indexNames.put(Yh.Yhlx_id_IndexName,SK_Plus.b(yhlx_id).e());
			
		if(!this.getFwq_id_Index().equals(SK_Plus.b(fwq_id).e()))
			indexNames.put(Yh.Fwq_id_IndexName,SK_Plus.b(fwq_id).e());
			
		if(!this.getQd_Index().equals(SK_Plus.b(qd).e()))
			indexNames.put(Yh.Qd_IndexName,SK_Plus.b(qd).e());
			
		if(!this.getLm_id_Index().equals(SK_Plus.b(lm_id).e()))
			indexNames.put(Yh.Lm_id_IndexName,SK_Plus.b(lm_id).e());
			
		if(!this.getQdYhlx_id_Index().equals(SK_Plus.b(qd,"_",yhlx_id).e()))
			indexNames.put(Yh.QdYhlx_id_IndexName,SK_Plus.b(qd,"_",yhlx_id).e());
			
		return indexNames;
	}
}